package com.yunche.yunchebusiness.mvp.model

import com.yunche.yunchebusiness.base.BaseResponse
import com.yunche.yunchebusiness.base.rx.SchedulerUtils
import com.yunche.yunchebusiness.entity.AreaEntity
import com.yunche.yunchebusiness.entity.ColorEntity
import com.yunche.yunchebusiness.entity.EvaluateEntity
import com.yunche.yunchebusiness.network.RetrofitManager
import io.reactivex.Observable
import okhttp3.RequestBody

/**
 * Create by Crcker on 2019/1/2 17:01
 * Email: Crcker@163.com
 */


class EvaluateModel {

    fun getColor(modelId: String): Observable<BaseResponse<ColorEntity>> {
        return RetrofitManager.service.getColor(modelId).compose(SchedulerUtils.ioToMain())
    }

    fun getArea(): Observable<BaseResponse<List<AreaEntity>>> {
        return RetrofitManager.service.getAreaList().compose(SchedulerUtils.ioToMain())
    }

    fun getEvaluate(requestBody: RequestBody): Observable<BaseResponse<EvaluateEntity>> {
        return RetrofitManager.service.getEvaluate(requestBody).compose(SchedulerUtils.ioToMain())
    }

    fun saveEvaluate(requestBody: RequestBody): Observable<BaseResponse<String>> {
        return RetrofitManager.service.saveEvaluateRecord(requestBody).compose(SchedulerUtils.ioToMain())
    }
}